import sys, os, re
import optparse
from my import *


import pathlib

toolnameRaw = pathlib.Path(__file__).absolute().parts[-1]
toolname = toolnameRaw[2:-5]



def func(isHelp=False):
    if isHelp:
        return [toolname, "... | ~ %s" % (toolname), ">formated table", "-h"]
    parser = optparse.OptionParser("")
    parser.add_option("-s", "--seprator", dest="seprator", default="\t")
    parser.add_option("-a", "--addspace", dest="addspace", default=3)
    parser.add_option("-c", "--addchar", dest="addchar", default="")
    options, args = parser.parse_args()
    if options.seprator == "space":
        options.seprator = " "
    rawTable = sys.stdin.readlines()
    refinedTable = map(lambda x: x.replace("\n", " ").split("\t"), rawTable)
    refinedTable = list(refinedTable)

    printTable(refinedTable, options)
